<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="mall/advert/include::header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5></h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="signupForm">
                        <div class="form-group">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>优惠券名称:</label>
                            <div class="col-sm-8">
                                <input id="ticketName" name="ticketName" class="form-control" type="text">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">商品品类:</label>
                            <div class="col-sm-8">
                                <select data-placeholder="" class="form-control chosen-select"
                                        tabindex="30" id="productGradeId" name="productGradeId">
                                    <option th:each="item: ${productGrades}" th:text="${item.name}"
                                            th:value="${item.id}"></option>
                                </select>
                            </div>
                        </div>

                        <!-- <div class="form-group">
                             <label class="col-sm-3 control-label">行业选择:</label>
                             <div class="col-sm-8">
                                 <select data-placeholder="" class="form-control chosen-select"
                                         tabindex="30" id="industryId" name="industryId">
                                     <option value="">-&#45;&#45;请选择-&#45;&#45;</option>
                                     <option th:each="item: ${industrys}" th:text="${item.name}"
                                             th:value="${item.id}"></option>
                                 </select>
                             </div>
                         </div>-->

                        <!-- <div class="form-group">
                             <label class="col-sm-3 control-label">品牌选择:</label>
                             <div class="col-sm-8">
                                 <select data-placeholder="" class="form-control chosen-select"
                                         tabindex="30" id="industryBrandId" name="industryBrandId">
                                     <option value="">-&#45;&#45;请选择-&#45;&#45;</option>
                                     <option th:each="item: ${industryBrands}" th:text="${item.name}"
                                             th:value="${item.id}"></option>
                                 </select>
                             </div>
                         </div>-->

                        <div class="form-group" id="selectIndustry">
                            <label class="col-sm-3 control-label">行业选择:</label>
                            <div class="col-sm-4">
                                <select data-placeholder="" class="form-control chosen-select" tabindex="2"
                                        id="industryId"
                                        name="industryId" onchange="industryChange(this)">
                                    <option value="" selected="selected">请先选择行业</option>
                                    <option th:each="item: ${industrys}" th:text="${item.name}"
                                            th:value="${item.id}"></option>
                                </select>
                            </div>
                            <div class="col-sm-4">
                                <select data-placeholder="" class="form-control chosen-select" tabindex="2"
                                        id="industryBrandId"
                                        name="industryBrandId">
                                    <option value="" selected="selected">请选择品牌</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group" th:if="${teamId == null}">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>所属门店:</label>
                            <div class="col-sm-8">
                                <select data-placeholder="" class="form-control chosen-select" id="teamId"
                                        name="teamId">
                                    <option value="0">选择门店</option>
                                    <option th:each="item: ${teamList}" th:text="${item.tXiaoqu+ +item.id}"
                                            th:value="${item.id}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>类型:</label>
                            <div class="col-sm-8">
                                <select id="type" name="type" data-placeholder="" class="form-control chosen-select"
                                        tabindex="2" onchange="onTypeChange()">
                                    <option th:each="item: ${types}" th:text="${item.name}"
                                            th:value="${item.code}"></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否支持多门店使用:</label>
                            <div class="col-sm-8">
                                <label class="radio-inline"> <input id="usableFlag0" type="radio"
                                                                    name="usableFlag"
                                                                    value="0" checked/>否</label>
                                <label class="radio-inline"> <input id="usableFlag1" type="radio"
                                                                    name="usableFlag"
                                                                    value="1"/>是</label>
                            </div>
                        </div>

                        <div class="form-group" style="display: none" id="selectTeam">
                            <label class="col-sm-3 control-label">选择可使用门店:</label>
                            <div class="col-sm-8">
                                <input id="usableTeam" name="usableTeam" class="form-control" type="hidden">
                                <input id="memberNames" name="memberNames" class="form-control"
                                       type="text" placeholder="点击选择可使用门店" readonly
                                       onclick="selectTeam()">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否聚合支付赠送:</label>
                            <div class="col-sm-8">
                                <label class="radio-inline"> <input id="isJuhepayTicket0" type="radio"
                                                                    name="isJuhepayTicket"
                                                                    value="0" checked/>否</label>
                                <label class="radio-inline"> <input id="isJuhepayTicket1" type="radio"
                                                                    name="isJuhepayTicket"
                                                                    value="1"/>是</label>
                            </div>
                        </div>

                        <div id="camilo" style="display: none">
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><em class="gg-star"
                                                                          style="margin-right: 7px">*</em>卡号:</label>
                                <div class="col-sm-8">
                                    <input id="cardNumber" name="cardNumber" class="form-control" maxlength="40">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><em class="gg-star"
                                                                          style="margin-right: 7px">*</em>密码:</label>
                                <div class="col-sm-8">
                                    <input id="password" name="password" class="form-control" maxlength="40">
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>优惠券发放总张数:</label>
                            <div class="col-sm-8">
                                <input id="total" name="total" class="form-control" type="number" min="1" value="1">
                            </div>
                        </div>
                        <div class="form-group" id="kmj_useNum">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>单张券可使用次数:</label>
                            <div class="col-sm-8">
                                <input id="count" name="count" value="1" max="10" class="form-control" type="number"
                                       min="0">
                            </div>
                        </div>

                        <div class="form-group" id="by_money_div">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>金额/折扣:</label>
                            <div class="col-sm-8">
                                <input id="amount" name="amount" class="form-control" type="number" min="0"
                                       placeholder="折扣券时为优惠券折扣">
                            </div>
                        </div>
                        <div class="form-group" id="by_money_div_ms">
                            <label class="col-sm-3 control-label"></label>
                            <div class="col-sm-8">
                                <em style="color: red">*抵扣券为金额折扣；折扣券、卡密券、聚合支付赠送券为百分比折扣；其余特殊券类不以此处为优惠标准</em>
                            </div>
                        </div>
                        <input type="hidden" name="centreId" th:value="${centreId}" th:if="${flag} == '1'">
                        <div class="form-group" th:if="${flag} == '0'">
                            <label class="col-sm-3 control-label">商户:</label>
                            <div class="col-sm-8">
                                <select name="centreId" class="form-control" type="text">
                                    <option value="">--请选择--</option>
                                    <option th:each="item: ${centreList}" th:text="${item.name}"
                                            th:value="${item.centreId}"></option>
                                </select>
                            </div>
                        </div>
                        <!--<input type="hidden" name="centreId" th:value="${centreId}">-->
                        <!--<div class="form-group" th:if="${flag == '1' and teamFlag == '0'}">-->
                        <!--<label class="col-sm-3 control-label">门店:</label>-->
                        <!--<div class="col-sm-8">-->
                        <!--<select name="teamId" class="form-control" type="text">-->
                        <!--<option value="">&#45;&#45;请选择&#45;&#45;</option>-->
                        <!--<option th:each="item: ${teamList}" th:text="${item.tXiaoqu}" th:value="${item.teamid}"></option>-->
                        <!--</select>-->
                        <!--</div>-->
                        <!--</div>-->

                        <div class="form-group">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>每人限领次数:</label>
                            <div class="col-sm-8">
                                <input id="limit" name="limit" class="form-control" type="number" min="1" value="1">
                            </div>
                        </div>

                        <div class="form-group" id="by_range">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>范围类型:</label>
                            <div class="col-sm-8">
                                <select id="rangeType" name="rangeType" data-placeholder=""
                                        class="form-control chosen-select" tabindex="2">
                                    <option value="">无限制</option>
                                    <option th:each="item: ${ranges}" th:text="${item.name}"
                                            th:value="${item.code}"></option>
                                </select>
                            </div>
                        </div>

                        <input id="shopId" name="shopId" th:value="${teamId}" type="hidden">
                        <div class="form-group" id="selectProduct">
                            <label class="col-sm-3 control-label">选择商品:</label>
                            <div class="col-sm-8">
                                <input id="productId" name="productId" class="form-control" type="hidden">
                                <input id="productName" placeholder="点击选择限制商品" name="productName" class="form-control"
                                       type="text" readonly onclick="selectProduct()">
                            </div>
                        </div>
                        <div class="form-group" id="selectCategory">
                            <label class="col-sm-3 control-label">选择分类:</label>
                            <div class="col-sm-4">
                                <select data-placeholder="" class="form-control chosen-select" tabindex="2" id="pcate"
                                        name="pcate" onchange="categoryChange(this)">
                                    <option value="" selected="selected">一级分类</option>
                                    <option th:each="item: ${categoryList}" th:text="${item.name}"
                                            th:value="${item.id}"></option>
                                </select>
                            </div>
                            <div class="col-sm-4">
                                <select data-placeholder="" class="form-control chosen-select" tabindex="2" id="ccate"
                                        name="ccate">
                                    <option value="" selected="selected">二级分类</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group" id="dpdkj_condition">
                            <label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>使用条件:</label>
                            <div class="col-sm-8">
                                <input id="condition" name="condition" class="form-control" type="number" min="0">
                                <span class="">订单满多少金额可用</span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">有效期:</label>
                            <div class="col-sm-8">
                                <div class="col-sm-6">
                                    <input type="text" class=" form-control"
                                           id="startTime" name="startTime" placeholder="生效时间"
                                           onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                                           style="background-color: #fff;" readonly="readonly"/>
                                </div>
                                <div class="col-sm-6">
                                    <input type="text" class=" form-control"
                                           id="endTime" name="endTime" placeholder="到期时间"
                                           onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                                           style="background-color: #fff;" readonly="readonly"/>
                                </div>
                            </div>
                        </div>
<!--                        <div class="form-group">-->
<!--                            <label class="col-sm-3 control-label">有效天数:</label>-->
<!--                            <div class="col-sm-8">-->
<!--                                <input id="period" name="period" class="form-control" type="number" min="0">-->
<!--                                <span class="">当有效天数设置后,将不按统一失效日期失效</span>-->
<!--                            </div>-->
<!--                        </div>-->
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"
                                   for="form-field-1"> 是否公开： </label>
                            <div class="col-sm-8" style="padding-top: 5px;">
                                <label for="isOpen1" class="radio-inline">
                                    <input type="radio" onclick='radioIsChecked()'
                                           name="isOpen" value="0" id="isOpen1"/> 是
                                </label> &nbsp;&nbsp;&nbsp;
                                <label for="isOpen2" class="radio-inline">
                                    <input type="radio" onclick='radioIsChecked()' name="isOpen"
                                           value="1" id="isOpen2" checked="checked"/> 否</label>
                            </div>
                        </div>

                        <div class="form-group" id="imageDiv">
                            <label class="col-sm-3 control-label">优惠卷图片:</label>
                            <div class="col-sm-6">
                                <input id="ticketImg" name="ticketImg" class="form-control" type="text"
                                       onblur="onThumbBlur()" readonly placeholder="批量上传图片">
                            </div>
                            <div class="col-sm-2">
                                <button class="btn btn-primary" type="button"
                                        onclick="selectImgs('ticketImg');">
                                    <i class="fa fa-check"></i>选择图片
                                </button>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label">优惠券描述:</label>
                            <div class="col-sm-8">
                                <textarea class="form-control" id="ticketDesc" name="ticketDesc"></textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">大礼包核销金额:</label>
                            <div class="col-sm-8">
                                <input type="number" class="form-control" id="bigGiftAmount" name="bigGiftAmount"/>
                            </div>
                        </div>

                        <div class="form-group text-center">
                            <div class="col-sm-8 col-sm-offset-2">
                                <button type="submit" class="btn btn-primary"><i class="fa fa-check"></i>提交</button>
                                <div class="btn btn-danger" onclick="closeDow()"><i class="fa fa-remove"></i> 关闭</div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="mall/advert/include::footer"></div>
<script type="text/javascript" src="/js/appjs/promotion/ticket/add.js">
</script>
<script type="text/javascript">
    function closeDow() {
        var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
        parent.layer.close(index);
    }

    $(function () {
        //页面加载完毕后开始执行的事件
        $("select[name='type']").change(function () {
            if ($(this).val() == "3" || $(this).val() == "4" || $(this).val() == "5") {
                $("#by_money_div").hide();
                $("#by_money_div_ms").hide();
                if ($(this).val() == "3") {
                    $("#by_range").hide();
                    $("#dpdkj_condition").show();
                }
                if ($(this).val() == "4") {
                    $("#by_range").show();
                    $("#dpdkj_condition").hide();
                }
                if ($(this).val() == "5") {
                    $("#by_range").hide();
                    $("#dpdkj_condition").hide();
                    $("#kmj_useNum").hide();
                }
            } else if ($(this).val() != "3" || $(this).val() != "4" || $(this).val() != "5") {
                $("#by_money_div").show();
                $("#by_money_div_ms").show();
                $("#by_range").show();
                $("#dpdkj_condition").show();
                $("#kmj_useNum").show();
            }
        });
    });
</script>
</body>

</html>
